﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharpBasic.DelegateTest
{

    /// <summary>
    /// </summary>
    public class DelegateTest4
    {

        /// <summary>
        /// 定义一个委托
        /// </summary>
        /// <param name="paramA"></param>
        /// <returns></returns>
        private delegate string InputChange(string paramA);


        public static string Mehtod1(string cellPhone)
        {
            return "输入的手机号" + cellPhone;
        }

        public static string Method2(string telPhone)
        {
            return "输入座机号" + telPhone;
        }

        /// <summary>
        /// new 一个委托需要指向一个方法
        /// str1.tostring 是一个String的一个方法名，
        /// 
        /// </summary>
        public static void DoTest1()
        {
            InputChange inputChange1 = new InputChange(Mehtod1);
            Console.WriteLine(inputChange1("13000000000"));

            InputChange inputChange2 = Mehtod1;
            Console.WriteLine(inputChange1("81185251"));
        }
    }
    
}
